import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import Components from 'unplugin-vue-components/vite'
import NutUIResolver from '@nutui/auto-import-resolver'
import { viteVConsole } from 'vite-plugin-vconsole';
import fs from 'fs'
import * as path from 'path'



// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
      vue(),
      Components({
        resolvers: [NutUIResolver()],
      }),
      viteVConsole({
          entry: path.resolve('src/main.ts'), // 或者可以使用这个配置: [path.resolve('src/main.ts')]
          enabled: true, // 可自行结合 mode 和 command 进行判断
          config: {
              maxLogNumber: 1000,
              theme: 'dark'
          }
      })
  ],
  server: {
    https: {
      key: fs.readFileSync('ssl/localhost-key.pem'),
      cert: fs.readFileSync('ssl/localhost.pem')
    },
    host: '0.0.0.0',
  }
})
